exception handling in python 2.7